package com.bailong.nanny.service.impl;

import com.bailong.nanny.d.NannyDao;
import com.bailong.nanny.dao.impl.NannyDaoImpl;
import com.bailong.nanny.entity.Nanny;
import com.bailong.nanny.entity.dto.NannyWorkDTO;
import com.bailong.nanny.service.NannyService;
import com.bailong.nanny.util.JdbcUtils;

import java.util.List;

public class NannyServiceImpl implements NannyService {
    NannyDao nannyDao = new NannyDaoImpl();
    @Override
    public List<Nanny> selectAllNanny() {
        return JdbcUtils.queryList(NannyDao.class,"select * from tb_nanny");
    }

    @Override
    public int deleteNanny(int id) {
        return JdbcUtils.update("DELETE FROM tb_nanny WHERE user_id = ?",id);
    }

    @Override
    public int updateNanny(Nanny nanny) {
        return 0;
    }

    @Override
    public int addNanny(Nanny nanny) {
        return JdbcUtils.update("insert into tb_user(username,realname,address,tel)values(?,?,?,?)");
    }

    @Override
    public List<NannyWorkDTO> selectAllNannyWork() {
        return nannyDao.selectAllNannyWork();
    }
}
